//
//  MovieCollectionViewCell.m
//  UI 作业 - 豆瓣电影
//
//  Created by hesiyao on 15/12/27.
//  Copyright © 2015年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "MovieCollectionViewCell.h"

@implementation MovieCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.titleImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_titleImg];
//        self.titleLabel.backgroundColor = [UIColor yellowColor];
        
        self.firstImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_firstImg];
//        self.firstImg.backgroundColor = [UIColor redColor];
        
        self.secondImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_secondImg];
//        self.secondImg.backgroundColor = [UIColor orangeColor];
        
        self.thirdImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_thirdImg];
//        self.thirdImg.backgroundColor = [UIColor blueColor];
        
        self.FourImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_FourImg];
//        self.FourImg.backgroundColor = [UIColor purpleColor];
        
        self.FiveImg = [[UIImageView alloc] init];
        [self.contentView addSubview:_FiveImg];
//        self.FiveImg.backgroundColor = [UIColor cyanColor];
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
//        self.titleLabel.backgroundColor = [UIColor magentaColor];
        
        self.ratingLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_ratingLabel];
//        self.ratingLabel.backgroundColor = [UIColor magentaColor];
        self.ratingLabel.font = [UIFont systemFontOfSize:13];
        self.ratingLabel.textColor = [UIColor orangeColor];
        
    }
    return self;
}

// 布局方法

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _titleImg.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height - 40);
    _titleLabel.frame = CGRectMake(0, _titleImg.frame.size.height, layoutAttributes.frame.size.width, 30);
    _firstImg.frame = CGRectMake(20, _titleImg.frame.size.height + _titleLabel.frame.size.height, 10, 10);
    _secondImg.frame = CGRectMake(30, _titleImg.frame.size.height + _titleLabel.frame.size.height, 10, 10);
    _thirdImg.frame = CGRectMake(40, _titleImg.frame.size.height + _titleLabel.frame.size.height, 10, 10);
    _FourImg.frame = CGRectMake(50, _titleImg.frame.size.height + _titleLabel.frame.size.height, 10, 10);
    _FiveImg.frame = CGRectMake(60, _titleImg.frame.size.height + _titleLabel.frame.size.height, 10, 10);
    _ratingLabel.frame = CGRectMake(70, _titleImg.frame.size.height + _titleLabel.frame.size.height, layoutAttributes.frame.size.width - 70, 10);
    
}

@end
